package com.onec.service.netty.coder;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.ReplayingDecoder;
import java.util.List;

/**
 * 自定义整数解密器
 */
public class ByteIntegerReplayingDecoder extends ReplayingDecoder {

  @Override
  protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {

    int i = in.readInt();
    System.out.println("解析出一个整数：" + i);
    out.add(i);

  }
}
